<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of ActionButtonColumn
 *
 * @author USER
 */
class ActionButtonColumn extends CButtonColumn {

    protected function renderButton($id, $button, $row, $data) {
        if (isset($button['visible']) && !$this->evaluateExpression($button['visible'], array('row' => $row, 'data' => $data)))
            return;
        $label = isset($button['label']) ? $this->evaluateExpression($button['label'], array('data' => $data, 'row' => $row)) : $id;
        $url = isset($button['url']) ? $this->evaluateExpression($button['url'], array('data' => $data, 'row' => $row)) : '#';
        $options = isset($button['options']) ? $button['options'] : array();
        if (isset($options['class']))
            $options['class'] = $this->evaluateExpression($options['class'], array('data' => $data, 'row' => $row));
        if (isset($options['data-status']))
            $options['data-status'] = $this->evaluateExpression($options['data-status'], array('data' => $data, 'row' => $row));    
        if (!isset($options['title']))
            $options['title'] = $label;
        if (isset($button['imageUrl']) && is_string($button['imageUrl']))
            echo CHtml::link(CHtml::image($button['imageUrl'], $label), $url, $options);
        else
            echo CHtml::link($label, $url, $options);
    }

}

?>
